

class AccountService {
    constructor ($http, $q, $rootScope,$cookies,Constant, Event, AjaxError,ResponseService,Logger,Http) {
        Object.assign(this, {$http, $q, $rootScope,$cookies,Constant, Event, AjaxError,ResponseService,Logger,Http});
    }

    /**
     * 查询账户信息
     */
    getAccountInfo(config) {
        let self =this;
        let config1 = config || {};
        return self.Http.post("api/get_account_info", {},config1) ;
    }

    /**
     * 查询购买记录
     * @param queryParam
     *
     * {
     *  "page_index": 2, //页码
     *   "page_size": 10,   //分页大小
     *  "lot_id": 31, //彩种代码,-9全部,彩种列表可以通过公共方法“get_lottery_type”获取
     *  "status": -9, 	//状态，-9全部，0已撤单，1待付款，2处理中，3出票中，4下单成功，5下单失败，6部份成功
     *  "start_date": "2019-08-16",  //查询开始日期
     *  "end_date": "2019-09-16"  //查询结束日期
     * }
     *
     */
    getOrderList(queryParam) {
        let self =this;
        return self.Http.post("api/get_order_list", queryParam);
    }

    /**
     * 查询中奖记录
     * @param queryParam
     * {
     *      "page_index": 2,  //页码
     *      "page_size": 10, //分页大小
     *      "lot_id": 31,   //彩种代码,-9全部,彩种列表可以通过公共方法“get_lottery_type”获取
     *      "status": -9, //状态，-9全部，0已撤单，1待付款，2处理中，3出票中，4下单成功，5下单失败，6部份成功
     *      "start_date": "2019-08-16", //查询开始日期
     *      "end_date": "2019-09-16" //查询结束日期
     *  }
     */
    getAwardList(queryParam) {
        let self =this;
        return self.Http.post("api/get_award_list", queryParam);
    }

    /**
     *查询资金明细
     * @param queryParam
     * {
     *   "page_index": 2,  //页码
     *   "page_size": 10,  //分页大小
     *   "trade_type": -1, 	//交易类型：1:充值，2银行转账，3撤单返款，4奖金派发，5其它收入，11购买彩票，12退款，19其它支出
     *   "start_date": "2019-08-16", //查询开始日期
     *   "end_date": "2019-09-16" //查询结束日期
     *  }
     */
    getFundDetailLis(queryParam) {
        let self =this;
        return self.Http.post("api/get_fund_detail_list", queryParam);
    }

    /**
     * 查询提现记录
     * @param queryParam
     *     {
     *   "page_index": 2,     //页码
     *   "page_size": 10,     //分页大小
     *   "start_date": "2019-08-16",     //查询开始日期
     *   "end_date": "2019-09-16",       //查询结束日期
     *   "cash_status": 1            	//提现状态：0未提现，1已提现
     *}
     */
    getCashLis(queryParam) {
        let self =this;
        return self.Http.post("api/get_cash_list", queryParam);
    }

    /**
     * 提现账号绑定
     * @param queryParam
     * {
     *   "cash_type": 2,                             //提现方式： 1网银,2支付宝,3微信
     *   "cash_account": "2012423892898923892",      //提现账号(网银、支付宝、微信账号)
     *   "user_name": "张三",                        //提现银行姓名(如果选择网银则必须传入该字段)
     *   "bank_name": "招商银行",                    //提现银行卡名称(如果选择网银则必须传入该字段), 下拉列表选择
     *   "bank_branch": "上海浦东支行",              //填写支行
     *   "cash_pwd": "123456"                        //提现密码
     *}
     */
    bindCashAccount(queryParam) {
        let self =this;
        return self.Http.post("api/cash_account_bind", queryParam);
    }

    /**
     *提现申请
     * @param queryParam
     *  {
     *   "cash_amount": "1000.00",    //提现金额
     *   "cash_pwd": "123456"         //提现密码
     *}
     */
    cashApply(queryParam) {
        let self =this;
        return self.Http.post("api/cash_apply", queryParam);
    }

    /**
     * 修改密码
     * @param queryParam
     * {
     *   "curr_pwd": "123456",  //当前密码
     *   "new_pwd": "123456", //新密码
     *   "confirm_new_pwd": "123456"//确认新密码
     *}
     */
    updatePwd(queryParam) {
        let self =this;
        return self.Http.post("api/update_pwd", queryParam);
    }

    /**
     * 充值
     * @param queryParam
     */
    chargeApply(queryParam){
        let self =this;
        return self.Http.post("api/charge_apply", queryParam);
    }

    /**
     * 获取最近未支付充值订单
     * @param queryParam
     */
    getCurrChargeOrders(){
        let self =this;
        return self.Http.post("api/get_curr_charge_order", {});
    }

    /**
     * 充值记录查询
     * @param queryParam
     */
    getChargeOrders(queryParam){
        let self =this;
        return self.Http.post("api/charge_order_list", queryParam);
    }

    /**
     * 获取公告信息
     */
    getNoticeInfo(config){
        let self =this;
        return self.Http.post("api/get_notice_info", {},config);
    }

    getAwardTip(config){
        let self =this;
        let config1  = config || {};
        return self.Http.post("api/get_award_tip", {},config1);
    }

    getProfitReport(queryParam){
        let self =this;
        return self.Http.post("api/get_profit_report", queryParam);
    }

    getOrderDetail(project_id){
        let self =this;
        return self.Http.post("api/get_order_detail?project_id="+project_id, {});
    }

    getAwardDetail(project_id){
        let self =this;
        return self.Http.post("api/get_award_detail?project_id="+project_id, {project_id});
    }

    chargeCancel(param){
        let self =this;
        return self.Http.post("api/charge_order_cancel", param,{});
    }

}

AccountService.$inject =
    ['$http', '$q', '$rootScope',"$cookies","Constant", 'Event', 'AjaxErrorHandler',"ResponseService","Logger","Http"];

export default AccountService;